package br.usp.icmc.biomac.shared;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@SuppressWarnings("serial")
public class Rectangle implements ROI {
	private Coordinate cood1 = new Coordinate();
	private Coordinate cood2 = new Coordinate();
	private String label;
	private Date date;

	public Rectangle(){}
	
	public Rectangle (Coordinate cood1, Coordinate cood2){
		this.cood1 = cood1;
		this.cood2 = cood2;
	}	
	public Rectangle (String label, Coordinate cood1, Coordinate cood2){
		this.label = label;
		this.cood1 = cood1;
		this.cood2 = cood2;
	}
	public Coordinate getCood1(){
		return this.cood1;
	}
	public void setCood1(Coordinate cood){
		this.cood1 = cood;
	}
	public Coordinate getCood2(){
		return this.cood2;
	}
	public void setCood2(Coordinate cood){
		this.cood2 = cood;
	}

	@Override
	public void setCoordinates(List<Coordinate> coordinates) {
		if (coordinates.size() == 2){
			this.cood1 = coordinates.get(0);
			this.cood2 = coordinates.get(1);
		}
	}

	@Override
	public List<Coordinate> getCoordinates() {
		List<Coordinate> result = new ArrayList<Coordinate>();
		result.add(cood1);
		result.add(cood2);
		return result;
	}

	@Override
	public void setLabel(String label) {
		this.label = label;
	}

	@Override
	public String getLabel() {
		return label;
	}

	@Override
	public void setDateTime(Date date) {
		this.date = date;
	}

	@Override
	public Date getDateTime() {
		return date;
	}

}
